import request from '@/utils/request'

// 获取在线设备列表
export function getOnlineDevices() {
  return request({
    url: '/iot/control/online',
    method: 'get'
  })
}

// 获取设备信息
export function getDeviceInfo(deviceId) {
  return request({
    url: `/iot/control/info/${deviceId}`,
    method: 'get'
  })
}

// 运行脚本
export function runScript(deviceId, data) {
  return request({
    url: `/iot/control/script/run/${deviceId}`,
    method: 'post',
    data: data
  })
}

// 停止脚本
export function stopScript(deviceId) {
  return request({
    url: `/iot/control/script/stop/${deviceId}`,
    method: 'post'
  })
}

// 获取设备截图
export function getScreenshot(deviceId) {
  return request({
    url: `/iot/control/screenshot/${deviceId}`,
    method: 'get'
  })
} 